home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / tcl / tclmotif.1 / tclmotif / tm.1.2 / src / tmAppInit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-27  |  3.6 KB  |  123 lines

  1. /* 
  2.  * tmAppInit.c --
  3.  *
  4.  *    Provides a tm version of the Tcl_AppInit procedure.
  5.  *
  6.  * Copyright (c) 1993 J.D. Newmarch
  7.  *
  8.  * Copyright (c) 1993 The Regents of the University of California.
  9.  * All rights reserved.
  10.  *
  11.  * Permission is hereby granted, without written agreement and without
  12.  * license or royalty fees, to use, copy, modify, and distribute this
  13.  * software and its documentation for any purpose, provided that the
  14.  * above copyright notice and the following two paragraphs appear in
  15.  * all copies of this software.
  16.  * 
  17.  * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
  18.  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
  19.  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
  20.  * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21.  *
  22.  * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
  23.  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  24.  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
  25.  * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
  26.  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  27.  */
  28.  
  29. #ifndef lint
  30. static char rcsid[] = "$Header";
  31. #endif /* not lint */
  32.  
  33. #include <tcl.h>
  34. #include "tmFuncs.h"
  35.  
  36. /*
  37.  * The following variable is a special hack that allows applications
  38.  * to be linked using the procedure "main" from the Tcl library.  The
  39.  * variable generates a reference to "main", which causes main to
  40.  * be brought in from the library (and all of Tcl with it).
  41.  */
  42.  
  43. extern int main();
  44. int *tclDummyMainPtr = (int *) main;
  45.  
  46. /*
  47.  * The following variable is a special hack that insures the tcl
  48.  * version of matherr() is used when linking against shared libraries
  49.  */
  50. #include <math.h>
  51. #if defined(DOMAIN) && defined(SING)
  52. extern int matherr();
  53. int *tclDummyMathPtr = (int *) matherr;
  54. #endif
  55.  
  56. /*
  57.  * The following hack insures XtAppInitialize() is linked in when using
  58.  * shared libraries
  59.  */
  60. Widget *tclDummyWidgetPtr = (Widget*)XtAppInitialize;
  61.  
  62.  
  63.  
  64.  
  65. /*
  66.  *----------------------------------------------------------------------
  67.  *
  68.  * Tcl_AppInit --
  69.  *
  70.  *    This procedure performs application-specific initialization.
  71.  *    This is the TclMotif version of this procedure. 
  72.  *    Applications that wish to use tclMotif with other extensions
  73.  *    should modify this procedure to add in other extensions.
  74.  *
  75.  * Results:
  76.  *    Returns a standard Tcl completion code, and leaves an error
  77.  *    message in interp->result if an error occurs.
  78.  *
  79.  * Side effects:
  80.  *    Depends on the startup script.
  81.  *
  82.  *----------------------------------------------------------------------
  83.  */
  84.  
  85. int
  86. Tcl_AppInit(interp)
  87.     Tcl_Interp *interp;        /* Interpreter for application. */
  88. {
  89.     /*
  90.      * Call the init procedures for included packages.  Each call should
  91.      * look like this:
  92.      *
  93.      * if (Mod_Init(interp) == TCL_ERROR) {
  94.      *     return TCL_ERROR;
  95.      * }
  96.      *
  97.      * where "Mod" is the name of the module.
  98.      */
  99.  
  100.     if (Tcl_Init(interp) == TCL_ERROR) {
  101.     return TCL_ERROR;
  102.     }
  103.  
  104.     if (Tm_Init(interp) == TCL_ERROR) {
  105.     return TCL_ERROR;
  106.     }
  107.  
  108.     /*
  109.      * Call Tcl_CreateCommand for application-specific commands, if
  110.      * they weren't already created by the init procedures called above.
  111.      */
  112.  
  113.     /*
  114.      * Specify a user-specific startup file to invoke if the application
  115.      * is run interactively.  Typically the startup file is "~/.apprc"
  116.      * where "app" is the name of the application.  If this line is deleted
  117.      * then no user-specific startup file will be run under any conditions.
  118.      */
  119.  
  120.     tcl_RcFileName = "tmrc";
  121.     return TCL_OK;
  122. }
  123.